﻿////////////////////////////////////////////////////////////////////////////////
// Source Copyright (C) J.Fan
// @author      J.Fan
// @date        2013-01-19
// @revision    Revision in Version Control System
// @remark      
////////////////////////////////////////////////////////////////////////////////

using System;
using System.Text;
using JsonConverter.Converter;

namespace JsonConverter.Writer
{
    public class StringBuilderJsonWriter: JsonWriter
    {
        StringBuilder jsonBuilder;

        public StringBuilderJsonWriter(StringBuilder builder,
            ConverterProvider converterProvider = null)
            : base(converterProvider)
        {
            if (builder == null) { throw new ArgumentNullException("builder"); }
            jsonBuilder = builder;
        }

        protected override void OnWriteLiteral(string jsonString)
        {
            jsonBuilder.Append(jsonString);
        }
    }
}
